package com.fancy;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import androidx.appcompat.app.AppCompatActivity;
import cn.fancy.sdk.FancyDemo;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;
import com.yanzhenjie.permission.runtime.Permission.Group;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        findViewById(R.id.text).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                //sdk的各个方法的调用示例，点进下方FancyDemo这个类里面查看
                Intent intent=new Intent(MainActivity.this, FancyDemo.class);
                startActivity(intent);
            }
        });
    
        
        AndPermission.with(this).runtime().permission(
            Permission.READ_PHONE_STATE,
            Permission.READ_EXTERNAL_STORAGE,
            Permission.WRITE_EXTERNAL_STORAGE
        )
            .onGranted(permissions -> {
                Intent intent=new Intent(MainActivity.this, FancyDemo.class);
                startActivity(intent);
            })
            .start();
    }
}
